#include "message.h"

#define MSG_POOL_CAPACITY 256

static uint8_t msg_pool[MSG_POOL_CAPACITY];

struct rt_ringbuffer msg_ring_buf;

int Msg_Init(void)
{
	rt_ringbuffer_init(&msg_ring_buf, msg_pool, MSG_POOL_CAPACITY); 
	return 0;
}

//static uint8_t message_buff[256];
SysMsg_TypeDef sys_msg;
void Msg_Process(void)  
{
	if(rt_ringbuffer_data_len(&msg_ring_buf)!= 0) 
	{
		rt_ringbuffer_get(&msg_ring_buf,(uint8_t *) &sys_msg.MsgId, sizeof(SysMsg_TypeDef));//��ȡ��Ϣ����(1�ֽ�) + ��Ϣ����(1�ֽ�)�����У���ͬ��Ϣ���Ͷ�Ӧ����Ϣ��������Ҳ��ͬ�����û����ж���

	    
		switch(sys_msg.MsgId)
		{
			case MSG_UART1_REC_FINISH:
				/*
				rt_ringbuffer_get(&usart1_recv_ring_buf, message_buff, sys_msg.msg_parameter);
			    message_buff[sys_msg.msg_parameter] = '\0';//sys_msg.msg_parameter
			    printf("%s\n",message_buff);
			    */
				break;
			
			default:
				break;
		}
		 
		
		
	}
	
	
}

